<?php
class BoxRecommendedFoodPlace extends TRepeaterItemRenderer
{
	public function onDataBinding($param)
	{
		parent::onDataBinding($param);		
		if (count($this->Data)>0)
		{		
			if ($this->ItemIndex%2)
				$this->Data->CssClass = "col_right";
			else 
				$this->Data->CssClass = "col_left";	
				
			if ($this->Data->IsNew == 1)
				$this->Data->CssClass .= " new";	
			
			$file = $this->Data->MainPhoto;
			$info = pathinfo($file);
			$file_name =  basename($file,'.'.$info['extension']); 
			$currentYear = date('Y', $this->Data->CreateDate);
			$currentMonth = date('m', $this->Data->CreateDate);
			$this->imgFoodPlacePhotoThumb->ImageUrl = $this->Request->UrlManagerModule->UrlPrefix."/useruploads/photos/food-place/".$currentYear."/".$currentMonth."/".$file_name.$this->Application->Parameters['FOOD_PLACE_PHOTO_THUMB_AFFFIX'].".".$info['extension'];	
			
			$this->lblOpenUntil->Text = "Open until 2 AM";
			
			if ($this->Data->OpenUntil > 0) {
					$closeTimeRecord = CloseTimeRecord::finder()->findByPk($this->Data->OpenUntil);				
					$this->lblOpenUntil->Text = "Open until " . $closeTimeRecord->CloseTime;
			} 
		}		
	}
}

?>